package com.wc.controller;

import com.wc.pojo.Authorize;
import com.wc.service.AuthorizeService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 授权控制层
 */
@RestController
public class AuthorizeController {

    @Autowired
    private AuthorizeService service;

    protected static Logger logger = LoggerFactory.getLogger(AuthorizeController.class);

    @RequestMapping("pastAuthorize")
    public Map<String,Boolean> pastAuthorize(Authorize authorize){
        Map<String,Boolean> map = new HashMap<>();
        logger.info("pastAuthorize===>前端参数===>"+authorize);
        boolean result = service.pastAuthorize(authorize);
        if (result){
            map.put("result",true);
        }else {
            map.put("result",false);
        }
        return map;
    }

    @RequestMapping("getAuthorizelistall")
    public List<Authorize> getAuthorizelistall(@RequestParam(defaultValue = "0")int pageNo, @RequestParam(defaultValue = "5")int pageSize){
        return service.getAuthorizelistall(pageNo,pageSize);
    }






}
